#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <locale>
#include <map>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>


#include "debug_macro.h"
#include "utils.h"
#include "speechAnalysisCut.h"


using namespace std;
using namespace boost;
#define MAX_STR_LENGTH  1024

/*some default information about speech file*/
static std::string no_header_speech_scp = "";
static int predefinedThreadNo = 1;
static int sampleRate = 8000;
static int byteNum = 2;




int ParseOpt(int argc, char* argv[], Options& option_states)
{
	const char * help_information = "speech file list file (in Kaldi scp format)\r\n \
		-h or --help, print this information.\r\n";
	if( (argc < 2) || (strcmp(argv[1],"-h") == 0)  || ! strcmp(argv[1], "--help") )
	{
		printf("%s\n",help_information);
		return -1;
	}
	for (int i=1;i<argc;i++)
	{
		if (option_states.CheckKey(argv[i]) )
		{
			std::string tmp_key_ = argv[i], tmp_value_ = argv[++i];
			if (option_states.add_options(tmp_key_, tmp_value_) < 0){
				return -1;
			}
			i--;
		}
	}
}
//end of Parseopt


int main(int argc, char* argv[])
{
	Options commandLine_opts;
	commandLine_opts.registration_options("--sample-rate");
	commandLine_opts.registration_options("--byte-width");
	commandLine_opts.registration_options("--scp-in");
	commandLine_opts.add_options("--sample-rate", boost::lexical_cast<string>(8000) );
	commandLine_opts.add_options("--byte-width", boost::lexical_cast<string>(2));
	if( ParseOpt(argc, argv, commandLine_opts)<0 )
	{
		return -1;
	}
	ProcessKaldiScp(commandLine_opts);
	return 0;
}
